﻿var center;

function addTab(title, url) {
    var tab = center.getComponent(id);
    if (!tab) {
        tab = center.add({
            title: title,
            closable: true,
            html: '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + url + '"> </iframe>'
            //autoLoad: { url: url, callback: this.initSearch, scope: this }
        });
    }
    center.setActiveTab(tab);
}

Ext.onReady(function () {

    var currentUserInfo = Ext.getDom("hidCurrentInfo").value

    var north = Ext.create("Ext.Component", {
        region: "north",
        xtype: "box",
        cls: "header",
        html: "",
        height: 5,
        contentEl: 'divHeader'
    });

    var south = Ext.create("Ext.Toolbar", {
        region: "south",
        height: 23,
        margins: "5 5 5 5",
        items: [currentUserInfo, "->", "->", "<font color='#0000FF'></font>&nbsp;&nbsp;"]
    });

    var west = Ext.create("Ext.Panel", {
        region: "west",
        //layout: "accordion",
        title: "功能菜单",
        width: 200,
        split: true,
        collapsible: true,
        margins: "0 0 0 5",
        border: true,
        contentEl: "divFunctionItems"
        //items: [{ title: "Accordion Item 1", collapsed: true}, { title: "Accordion Item 2"}]
    });    

    center = Ext.create("Ext.TabPanel", {
        region: "center",
        margins: "0 5 0 0",
        html: "hello",
        deferredRender: false,
        items: [{ title: "待办任务", html: '<iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="Flow/FlowToDo.aspx"> </iframe>'}]
    });

    Ext.create("Ext.Viewport", {
        layout: "border",
        items: [north, west, center, south]
    });

});

